package bairui.international.console.web.controller.request.agent;

/**
 * @see bairui.international.console.web.controller.request.agent.Page_BaseFilter
 *
 */
class Page_Filter

{
	
	/**
	 * 过滤扩展接口
	 */
	static interface FilterExtends {
	}
	
	final static com.querydsl.core.BooleanBuilder query(
		bairui.international.model.domain.jpa.QTB_UserAgentRequestOrder QRoot,
		javax.servlet.http.HttpServletRequest request
	) {
		com.querydsl.core.BooleanBuilder query = query(
				QRoot
	,			com.sh_lianjing.string.util.Util_String.parseToType(
						request.getParameter("number"), 
						String.class, 
						"yyyy-MM-dd"
					)
	,			com.sh_lianjing.string.util.Util_String.parseToType(
						request.getParameter("nickName"), 
						String.class, 
						"yyyy-MM-dd"
					)
	,			com.sh_lianjing.string.util.Util_String.parseToType(
						request.getParameter("name"), 
						String.class, 
						"yyyy-MM-dd"
					)
	,			com.sh_lianjing.string.util.Util_String.parseToType(
						request.getParameter("phone"), 
						String.class, 
						"yyyy-MM-dd"
					)
	,			com.sh_lianjing.string.util.Util_String.parseToType(
						request.getParameter("state"), 
						bairui.international.model.status.State_UserAgentRequestOrder.class, 
						"yyyy-MM-dd"
					)
	,			com.sh_lianjing.string.util.Util_String.parseToType(
						request.getParameter("submitDate_start"), 
						java.util.Date.class, 
						"yyyy-MM-dd"
					),
				com.sh_lianjing.string.util.Util_String.parseToType(
						request.getParameter("submitDate_end"), 
						java.util.Date.class, 
						"yyyy-MM-dd"
					)
	,			com.sh_lianjing.string.util.Util_String.parseToType(
						request.getParameter("verifyDate_start"), 
						java.util.Date.class, 
						"yyyy-MM-dd"
					),
				com.sh_lianjing.string.util.Util_String.parseToType(
						request.getParameter("verifyDate_end"), 
						java.util.Date.class, 
						"yyyy-MM-dd"
					)
			);
			/* comment 附加过滤属性 */
	;
		return query;
	}
	
	final static com.querydsl.core.BooleanBuilder query(
		bairui.international.model.domain.jpa.QTB_UserAgentRequestOrder QRoot
	,	String number
	,	String nickName
	,	String name
	,	String phone
	,	bairui.international.model.status.State_UserAgentRequestOrder state
	,	java.util.Date submitDate_start,
		java.util.Date submitDate_end
	,	java.util.Date verifyDate_start,
		java.util.Date verifyDate_end
	) {
		com.querydsl.core.BooleanBuilder builder = new com.querydsl.core.BooleanBuilder();
	
		if(null != number){
			builder.and(QRoot.number.like("%"+number+"%"));
		}
		if(null != nickName){
			builder.and(QRoot.nickName.like("%"+nickName+"%"));
		}
		if(null != name){
			builder.and(QRoot.name.like("%"+name+"%"));
		}
		if(null != phone){
			builder.and(QRoot.phone.like("%"+phone+"%"));
		}
		if(null != state){
			builder.and(QRoot.state.eq(state));
		}
		if(null != submitDate_start && null != submitDate_end){
			builder.and(QRoot.submitDate.between(submitDate_start, submitDate_end));
		}
		if(null != verifyDate_start && null != verifyDate_end){
			builder.and(QRoot.verifyDate.between(verifyDate_start, verifyDate_end));
		}
		return builder;
	}
	
}
